import { IImage, IImageDto } from "../interfaces"
import { instance } from "./api.interceptor"




export const ImageServise = {
    async getOne(imageId: number): Promise<IImage> {
        const resp = await instance.get<IImage>(`/image/${imageId}`)
        return resp.data
    },

    async getAll(): Promise<IImage[]> {
        const resp = await instance.get<IImage[]>(`/image/`)
        return resp.data
    },

    async create(dto: IImageDto): Promise<IImage> {
        const resp = await instance.post<IImage>('/image', dto)
        return resp.data
    },

    async remove(id: number): Promise<IImage> {
        const resp = await instance.delete<IImage>(`/image/${id}`)
        return resp.data
    }

}
